from Common.EventHandle import EventHandle
from Calendar.Calendar import TradingCalendar
from FinancialAsset.AssetFactory import *

class DemoStrategy(EventHandle):

	def __init__(self, start_date, end_date, exch_list):
	
		trd_dates = TradingCalendar(exch_list).date_series(start_date, end_date, Frequency.Daily)

		EventHandle.__init__(self, trd_dates)

	def create_activities(self, ref_date, portfolio = None):
	
		cash = AssetFactory().acquire_asset('CASH', 'CNY')
		stock = AssetFactory().acquire_asset('STOCK', '600143')
	
		return [(ref_date, stock, 1), (ref_date, cash, -5.0)]
		
	@staticmethod	
	def event_name():
		return 'DemoStrategy'		
